truncate table [$temptable1]
insert into [$temptable1] with (HOLDLOCK TABLOCKX)
select [$Datatable].[$IndexId],
case when Row_number() 
	over (Order by [$DataColumn]) <=$Number then 0 else 1 end
from [$Datatable] 
